<extend name="Layout/ins_page" />
<block name="content">
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    <div  id='fm1'>
       <fieldset id="fd1" style="border: 1px solid #e5e5e5;height: 50px">
        <legend><span></span></legend>
        <div id="fm1">
        <div class="fieldset-body" style="margin:0px 5px;">
                 
 <!--          买家姓名： <input id="U_Cstname"  name="U_Cstname" class="mini-textbox" enabled='false' />
          手机号码： <input  id="U_Phone"  name="U_Phone" class="mini-textbox"  value=""enabled='false' /><br/><br/> -->
         <!--订单号： <input type="text" id="orderSn"  name="orderSn" class="mini-textbox" autocomplete="off" placeholder="" />
         手机号：<input type="text" class="mini-textbox" autocomplete="off" placeholder="" id="phone" name="phone">-->  
        订单号： <input type="text" id="order_code"  name="order_code" class="mini-textbox" autocomplete="off" placeholder="" />
         结算批次： <input type="text" id="batch_no"  name="batch_no" class="mini-textbox" autocomplete="off" placeholder="" />
        结算状态： <select name='is_balance' id="is_balance" class="is_balance" >
                    <option value=''>请选择</option>
                    <option value=0>未结算</option>
                    <option value=1>已结算</option>
                    <option value=2>已收款</option>
                </select>
          <a class="mini-button" onClick="search()" style="margin-left:20px;"><span class="mini-button-text ">&nbsp;&nbsp;查询&nbsp;&nbsp;</span></a>
          <a  style="float:right;" class="mini-button" onClick="exportData()"><span class="mini-button-text ">&nbsp;&nbsp;导出&nbsp;&nbsp;</span></a>  
          
        </div>
        
        
        
          </div>
    </fieldset>
     
        <div class="fieldset-body">

            <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;margin-top: 5px;overflow:auto;" plain="false"
                 buttons="#tabsButtons"
            >
                <div title="列表：" >

                    <div id="datagrid1" class="mini-datagrid" style="height:430px;width: 100%;"
                         url="index.php?m=&c=Boc365&a=getOrderlist" idField="id"
                         allowResize="true"
                         allowCellEdit="true" allowCellSelect="true" multiSelect="true"
                         allowCellValid="true" oncellvalidation=""
                    >

                        <div property="columns">

                           
                             <div field="order_code"  headerAlign="center"  >订单号
                                <input property="" class="mini-textbox" style="width:100%;" />
                            </div>
                             <div field="ctime"  headerAlign="center"  >创建时间
                                <input property="" class="mini-textbox" style="width:100%;" />
                            </div>
                             <div field="is_balance"  headerAlign="center"  >结算状态
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 

                            <div field="batch_no"  headerAlign="center"  >结算批次
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                            <!--<div field="update"  headerAlign="center"  >操作
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div>-->

                        </div>
                    </div>
                </div>
                <!-- <div title="Tab2" iconCls="" >
                    2
                </div> -->
            </div>
        </div>
    </div>


    </body>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.setPageSize(50);
        grid.load();
        grid.on("drawcell", function (e) {
            var record = e.record,
                column = e.column,
                field = e.field,
                value = e.value;
			if (field == "is_balance") {
				if(value==1)
				{
                  e.cellHtml ='已结算';
				}else if(value==2){
				  e.cellHtml ='已收款';
				}else{
				  e.cellHtml ='未结算';
				}
            }
			
			if (field=="ctime") {
                 e.cellHtml = mini.formatDate(value,"yyyy-MM-dd HH:mm:ss");

             }
			
			/*if (field == "update") {
                e.cellHtml = '<a href="javascript:updatePlatform(\''+record.CardCode+'\')"  >编辑</a>';
            }*/
			
			

        });
         function search(){
			var batch_no= mini.get('batch_no').getValue();
			var order_code = mini.get('order_code').getValue();
			var  myselect=document.getElementById("is_balance");
                          var index=myselect.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var is_balance=myselect.options[index].value;
	       grid.load({order_code: order_code,is_balance:is_balance,batch_no:batch_no})     
      	
        }
		
         

        function approve(list_tag,approve) {

            //确认提示
            mini.confirm("确定？", "确定？",
                function (action) {
                    if (action == "ok") {

                        $.ajax({
                            url: "/SapSupplier/doupdatesapitemfromexcel",
                            type: "post",
                            data: {list_tag: list_tag, approve: approve},
                            dataType: 'json',
                            success: function (data) {
                                mini.alert(data.msg);
                            }
                        });


                    } else {

                    }
                }
            );

        }

      function exportData()
	  {
			var batch_no= mini.get('batch_no').getValue();
			var order_code = mini.get('order_code').getValue();
			var  myselect=document.getElementById("is_balance");
                          var index=myselect.selectedIndex ;             // selectedIndex代表的是你所选中项的index
						  var is_balance=myselect.options[index].value;
	        var url="index.php?m=&c=Boc365&a=exportOrderlist&batch_no="+batch_no+"&order_code="+order_code+"&is_balance="+is_balance;
	        location.href=url;
	  }


    </script>
</block>

